package com.zzxx.mapper;

import com.zzxx.entity.Coupon;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

public interface CouponMapperEx {
    @Select("select * from coupon where id not in(select couponId from usercoupon where userId=#{uid})")
    List<Coupon> findByNoUid(String uid);

    @Results({
            @Result(column="id", property="id", jdbcType= JdbcType.VARCHAR, id=true),
            @Result(column="name", property="name", jdbcType=JdbcType.VARCHAR),
            @Result(column="type", property="type", jdbcType=JdbcType.INTEGER),
            @Result(column="number", property="number", jdbcType=JdbcType.DOUBLE),
            @Result(column="indate", property="indate", jdbcType=JdbcType.INTEGER),
            @Result(column="lastNum", property="lastnum", jdbcType=JdbcType.INTEGER),
            @Result(column="introduce", property="introduce", jdbcType=JdbcType.VARCHAR),
            @Result(column="targetId", property="targetid", jdbcType=JdbcType.VARCHAR),
            @Result(column="src", property="src", jdbcType=JdbcType.VARCHAR)
    })
    @Select("select * from coupon where id in (select couponId from usercoupon where userId=#{uid})")
    List<Coupon> selectByUid(String uid);
}
